#!/bin/bash
mkdir -p xxl-job-api-base/src/main/java
echo "build ..."
rm -rf output/*
mkdir -p output

if [ "ci" = $1 ] ; then
    mvn clean compile -pl xxl-job-api-base,xxl-job-api-bundle -am -Dbdgc.skip=false
elif [ "ut" = $1 ] ; then
    mvn clean verify -pl xxl-job-api-jacoco-report -am -Put -Dbdgc.skip=false
elif [ "package_server" = $1 ] ; then
    mvn clean package -pl xxl-job-api-server -am -Dbdgc.skip=false
    cp xxl-job-api-server/target/xxl-job-api-server.jar ./output
elif [ "package_mock_server" = $1 ] ; then
    mvn clean package -pl xxl-job-api-mock-server -am -Dbdmgc.skip=false
    cp xxl-job-api-mock-server/target/xxl-job-api-mock-server.jar ./output
elif [ "clean_all" = $1 ] ; then
    mvn clean
    rm -rf output
    rm -rf xxl-job-api-bundle/src
    rm -rf xxl-job-api-bundle-mock/src
fi
echo "build done."
